package com.genexususa.eo.bing.data.results;

import com.genexususa.eo.bing.CampaignManagementServiceClasses.BatchError;
import com.genexususa.eo.bing.CampaignManagementServiceClasses.EditorialError;
import com.genexususa.eo.bing.data.GxItemException;

import javax.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Bing_TargetIdAdGroupIdResults")
public class GxTargetIdAdGroupIdResults extends GxGeneralResults {
    @XmlElementWrapper(name = "TargetIdAdGroupIdResultCollection")
    @XmlElement(name = "TargetIdAdGroupIdResult")
    public GxTargetIdAdGroupIdResult[] targetIdAdGroupIdResultCollection;

    public GxTargetIdAdGroupIdResults() {
        super();
    }

    public GxTargetIdAdGroupIdResults(int resultQuantity) {
        super();
        this.targetIdAdGroupIdResultCollection = new GxTargetIdAdGroupIdResult[resultQuantity];
    }

    public void addResult(int index, GxTargetIdAdGroupIdResult trackingIdResult) {
        this.targetIdAdGroupIdResultCollection[index] = trackingIdResult;
    }

    public void addGxExceptionError(GxItemException error, int index) {
        this.targetIdAdGroupIdResultCollection[index].addGxExceptionError(error, index);
    }

    public void addBatchError(BatchError error) {
        this.targetIdAdGroupIdResultCollection[error.getIndex()].addBatchError(error);
    }

    public void addEditorialError(EditorialError error) {
        this.targetIdAdGroupIdResultCollection[error.getIndex()].addEditorialError(error);
    }

    public GxTargetIdAdGroupIdResult[] getTargetIdAdGroupIdResultCollection() {
        return targetIdAdGroupIdResultCollection;
    }

    public void setError() {
        this.hasError = true;
    }
}
